package edu.kit.aifb.ldstream.stat.distrib;

import java.io.Serializable;

public class ExponentialDistribution implements IDistribution, Serializable{


	private static final long serialVersionUID = 6752562221741479146L;

	private double lambda;
	
	public ExponentialDistribution(double lambda){
		this.lambda = lambda;
	}
		
	public double getLamda(){
		return this.lambda;
	}

	@Override
	public int getDistributionType() {
		return IDistribution.EXPONENTIAL;
	}

	public String toString(){
		StringBuilder sb = new StringBuilder(" ExponentialDistribution with ");
		sb.append("lambda: ");
		sb.append(this.lambda);
		return sb.toString();
	}
	
	public boolean equals(Object o){
		if(o instanceof ExponentialDistribution){
			ExponentialDistribution ed = (ExponentialDistribution) o;
			return Math.abs(this.lambda - ed.lambda) < 0.01d;
		}
		return false;
	}
	
	public int hashCode(){
		return (int) (this.lambda * 100000);
	}
}
